//
//  LOIncident.m
//  LegalObserver
//
//  Created by Roxanne Brittain on 10/30/11.
//  Copyright (c) 2011 Digifit. All rights reserved.
//

#import "LOIncident.h"
#import "LOAppDelegate.h"

@implementation LOIncident
@synthesize cops, arrestees, date, location, title, notes;

-(id)init
{
    self = [super init];
    if (self) {
        cops = [[NSMutableArray alloc] init];
        arrestees = [[NSMutableArray alloc] init];
    }
    return self;
}

-(NSString*)stringDescription
{
    return [NSString stringWithFormat:@"Title: %@\nDate: %@\nLocation: %@\nNotes: %@\n\nCOPS:\n%@\nINVOLVED PEOPLE:\n%@", title, [LOAppDelegate stringFromDate:date], location, notes, [LOAppDelegate stringDescriptionForArray:cops], [LOAppDelegate stringDescriptionForArray:arrestees]];
}

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:cops forKey:@"cops"];
    [coder encodeObject:arrestees forKey:@"arrestees"];
    [coder encodeObject:date forKey:@"date"];
    [coder encodeObject:location forKey:@"location"];
    [coder encodeObject:title forKey:@"title"];
    [coder encodeObject:notes forKey:@"notes"];
}

- (id)initWithCoder:(NSCoder *)coder {
    self = [super init];
    title = [coder decodeObjectForKey:@"title"];
    notes = [coder decodeObjectForKey:@"notes"];
    location = [coder decodeObjectForKey:@"location"];
    date = [coder decodeObjectForKey:@"date"];
    arrestees = [coder decodeObjectForKey:@"arrestees"];
    cops = [coder decodeObjectForKey:@"cops"];
    return self;
}

@end
